<template>
	<view>
		<view class="box" style="padding: 0 30rpx;">
			<view class="flex row">
				<view>姓名</view>
				<view>{{data.patient_name}}</view>
			</view>
			<view class="flex row">
				<view>性别</view>
				<view>{{data.patient_gender == 0 ? '女' : '男'}}</view>
			</view>
			<!-- <view class="flex row">
				<view>出生日期</view>
				<view>2023-02-07</view>
			</view> -->
			<view class="flex row">
				<view>年龄</view>
				<view>{{data.patient_age}}</view>
			</view>
		</view>
		<view class="flex mt-25">
			<view class="bold size-28 ml-30">病历卡信息</view>
			<view class="flex">
				<!-- <view v-for="i in data.case_list" class="a btn" style="width: 150rpx;">{{i.description}}</view> -->
				<view class="a btn ml-20" style="width: 150rpx;">补充病历</view>
			</view>
		</view>
		<view class="box" @click="navto">
			<view class="size-28">{{data.appoint_time}}记录</view>
			<view class="size-28 mt-20">患者自述：</view>
			<!-- <view class="size-24 mt-20" style="color: #666;">
				擅长:头痛、失眠、高血压、高血脂、便秘头痛、失眠、高血压、高血脂、便秘...擅长:头痛、失眠、高血压、高血脂、便秘头痛、失眠、高血...
			</view> -->
			<view class="size-24 mt-20" style="color: #666;">
				{{data.case_status}}
			</view>
			<view class="bottom">
				查看病历详情
			</view>
		</view>

		<template v-if="data.status == 2 || data.status == 3">
			<view class="flex mt-25">
				<view class="bold size-28 ml-30">患者已支付费用</view>
			</view>
			<view class="box size-24">
				挂号费用：￥{{data.appoint_price}}（已支付）
			</view>
		</template>

		<template v-if="data.status == 2">
			<view class="flex mt-25">
				<view class="bold size-28 ml-30">药品信息</view>
				<view class="flex">
					<view class="a btn" style="width: 350rpx;" @click="affirm">确认收款</view>
				</view>
			</view>
			<view class="box">
				<view class="size-28">药品名称及各自金额：</view>
				<view class="size-24 pt-20 pb-20" style="color: #666;border-bottom: 2rpx solid #f1fff1;">
					麻黄汤：麻黄9克、桂枝6克、杏仁9克、甘草3克
					荆防败毒散：荆芥、防风、羌活、独活、川芎、柴胡、前胡、桔梗、枳壳、茯苓各30克、甘草15克
				</view>
				<view class="size-28">药品备注：</view>
				<view class="size-24 pt-20 pb-20" style="color: #666;border-bottom: 2rpx solid #f1fff1;">
					一天三顿，一顿两幅药，药前忌辣
				</view>
				<view class="size-28">药品价格：</view>
				<view class="size-24 pt-20 pb-20" style="color: #666;border-bottom: 2rpx solid #f1fff1;">
					￥{{data.medicine_price}}
				</view>
				<!-- <view class="bottom">
				查看病历详情
			</view> -->
			</view>
		</template>

		<template v-if="data.status == 3">
			<view class="flex mt-25">
				<view class="bold size-28 ml-30">订单详情</view>
			</view>
			<view class="box size-24" style="line-height: 38rpx;">
				<view class="flex">
					<view class="size-28">收货人名称</view>
					<view class="size-28">安稳.</view>
				</view>
				<view class="flex mt-20">
					<view class="size-28">收货人手机号</view>
					<view class="size-28">18831012345</view>
				</view>
				<view class="flex mt-20">
					<view class="size-28">收货人地址</view>
					<view class="size-28" style="width: 384rpx;text-align: right;">某某县某某某某市某某区某某县某某街道唠唠村256号</view>
				</view>
			</view>
			<view class="box size-24" style="line-height: 38rpx;">
				<view class="flex">
					<view class="size-28">订单编号</view>
					<view class="size-28" style="color: #999;">12312345646080010023</view>
				</view>
				<view class="flex mt-20">
					<view class="size-28">创建时间</view>
					<view class="size-28" style="color: #999;">2023-03-02 15：00</view>
				</view>
				<view class="flex mt-20">
					<view class="size-28">付款时间</view>
					<view class="size-28" style="color: #999;">2023-03-02 15：00</view>
				</view>
				<view class="flex mt-20">
					<view class="size-28">发货时间</view>
					<view class="size-28" style="color: #999;">2023-03-02 15：00</view>
				</view>
				<view class="flex mt-20">
					<view class="size-28">签收时间</view>
					<view class="size-28" style="color: #999;">2023-03-02 15：00</view>
				</view>
			</view>
		</template>

		<view class="footer flex" v-if="data.status == 2">
			<view class="btn" @click="kaiyao">开药</view>
			<view class="btna" @click="finishOrder">完成订单</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				data: {}
			};
		},
		onLoad(op) {
			this.id = op.id
			this.detail()
			this.hintBs()
			this.hintSc()
		},
		methods: {
			//提示病史
			hintBs(){
				this.$api.replenish({
					order_id: this.id
				}).then(res => {
					
				})
			},
			//提示上传
			hintSc(){
				this.$api.hint({
					order_id: this.id
				}).then(res => {
					
				})
			},
			
			finishOrder(){
				this.$api.completeOrder({
					order_id: this.id
				}).then(res => {
					this.$utils.showToast(res.msg)
				})
			},
			affirm(){
				this.$api.payOrder({
					order_id: this.id
				}).then(res => {
					this.$utils.showToast(res.msg)
				})
			},
			kaiyao() {
				uni.navigateTo({
					url: '/pages/index/patientInfo/openMedicine/openMedicine?id=' + this.id
				})
			},
			detail() {
				this.$api.orderDetail({
					order_id: this.id
				}).then(res => {
					this.data = res.data
				})
			},
			navto() {
				uni.navigateTo({
					url: './info/info?id=' + this.id + '&department_id=' + this.data.department_id
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f8f8f8;
	}

	.bottom {
		padding: 20rpx 0 0 0;
		border-top: 2rpx solid #F1F1F1;
		color: #882027;
		font-size: 28rpx;
		text-align: center;
		margin-top: 30rpx;
	}

	.footer {
		padding: 160rpx 60rpx 80rpx;

		view {
			width: 300rpx;
		}
	}

	.a {
		width: 210rpx;
		height: 50rpx;
		line-height: 50rpx;
		border: 2rpx solid #882027;
		background: #f8f8f8 !important;
		color: #882027 !important;
		margin-right: 20rpx;
	}

	.row {
		padding: 40rpx 0;
		border-bottom: 2rpx solid #f8f8f8;
		font-size: 28rpx;
	}

	.row:last-child {
		border: none;
	}

	.box {
		width: 690rpx;
		background: #FFFFFF;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		margin: 30rpx auto 0;
		padding: 30rpx;
	}
</style>
